home *** CD-ROM | disk | FTP | other *** search
/ Magnum One / Magnum One (Mid-American Digital) (Disc Manufacturing).iso / d12 / cbibcode.arc / INPORT.C < prev    next >
Encoding:
C/C++ Source or Header  |  1991-08-05  |  557 b   |  18 lines

  1. /* inport.c --- p 517 */
  2. #include <stdio.h>
  3. #include <conio.h>
  4. #define PORT_8259_20   0x20
  5. #define PORT_8259_21   0x21
  6. main()
  7. {
  8.     unsigned int word_8259;
  9.     int p20, p21;
  10.                     /* Read both ports of the 8259A */
  11.     word_8259 = inport(PORT_8259_20);
  12.                     /* Now read them individually */
  13.     p20 = inportb(PORT_8259_20);
  14.     p21 = inportb(PORT_8259_21);
  15.     printf("Current contents of register at port 20h: %x\n", p20);
  16.     printf("Current contents of register at port 21h: %x\n", p21);
  17.     printf("Result of reading with inpw at port 20h: %x\n", word_8259);
  18. }